﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using Projectmanagement.Utl;
using Projectmanagement.Entity;

namespace ProjectManagement.Models
{
    public class _City : EntityBase
    {
        [Display(Name = "城市名称"), Required]
        public string Name { get; set; }
        [Display(Name = "所属国家"), Required]
        public int? CountryID { get; set; }

        public IEnumerable<SelectListItem> GetCountrySelectListItems()
        {
            var selectList = CH.DB.Countrys.ToList().Select(a => new SelectListItem
            {
                Text = a.Name,
                Value = a.ID.ToString()
            });
            return selectList;
        }
    }
}